package cn.chia.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.chia.back.dao.IAddressDAO;
import cn.chia.pojo.Address;
import cn.chia.service.IAddressService;

@Service
public class AddressServiceImpl implements IAddressService {

	private IAddressDAO addressDAOImpl;
	
	public void saveAddress(Address address) throws Exception {
		addressDAOImpl.doCreate(address);
	}

	public void deleteAddress(int id) throws Exception {
		addressDAOImpl.doRemove(id);
	}

	@Resource(name="addressDAOImpl")
	public void setAddressDAOImpl(IAddressDAO addressDAOImpl) {
		this.addressDAOImpl = addressDAOImpl;
	}

	public List<Address> findAllAddress(int userid) throws Exception {
		return addressDAOImpl.findAll(userid);
	}

	public Address findByIdAndFlag(int userid, int flag) throws Exception {
		
		return addressDAOImpl.findByIdAndFlag(userid, flag);
	}

	public Address findById(int addrId) throws Exception {
		
		return addressDAOImpl.findById(addrId);
	}

	public void updateAddress(Address addr) throws Exception {
		addressDAOImpl.doUpdate(addr);
		
	}

	
	
	

}
